<?php


namespace App\Models;


class Subject extends BaseModel
{
    protected $table = 'subjects';

    protected $fillable = [
        "user_id",
        "type",
        "name",
        "number",
        "tel",
        "img",
        "auth_pid",
        "auth_img",
        "auth_type",
        "status",
    ];

    protected $appends = ['status_att','type_att', 'auth_type_att'];

    public static $EnumType = [
        0 => '个人', 1 => '公司'
    ];

    public static $EnumAuthType = [
        0 => '实名认证', 1 => '法人认证', 2 => "授权认证", 3 => "对公转账认证"
    ];

    public static $EnumStatus = [
        0 => '认证中', 1 => "认证通过", 2=>"认证不通过"
    ];
    public function getStatusAttAttribute()
    {
        return self::$EnumStatus[$this->status] ?? $this->status;
    }
    public function getTypeAttAttribute()
    {
        return self::$EnumType[$this->type] ?? $this->type;
    }
    public function getAuthTypeAttAttribute()
    {
        return self::$EnumAuthType[$this->auth_type] ?? $this->auth_type;
    }

}
